/// @description Insert description here
// You can write your code in this editor

lerpProgress += (1 - lerpProgress) / 50;
textProgress += global.textSpeed;

x1 = lerp(x1, x1Target, lerpProgress);
x2 = lerp(x2, x2Target, lerpProgress);

// 循环回答数组
keyUp = keyboard_check_pressed(vk_up) || keyboard_check_pressed(ord("W"));
keyDown = keyboard_check_pressed(vk_down) || keyboard_check_pressed(ord("S"));
responseSelected += (keyDown - keyUp);
var _max = array_length(response) - 1;
var _min = 0;
if(responseSelected > _max) responseSelected = _min;
if(responseSelected < _min) responseSelected = _max;



if(keyboard_check_pressed(vk_space))
{
	var _messageLength = string_length(messageText);
	if(textProgress >=_messageLength)
	{
		//选择回答 弹出新的对话框
		if(response[0] != -1)
		{
			with(originInstance) DialogueResponses(other.responseScript[other.responseSelected])
		}
		
		instance_destroy();	
		if(instance_exists(oTextQueued))
		{
			with(oTextQueued)ticket--;
		}
		else
		{
			with(oPlayer) state = lastState;
		}
	}
	else
	{
		if(textProgress >2)
		{
			textProgress = _messageLength;
		}
	}
}
